// pages/mycard/card_detail/card_detail.js
const app = getApp();
var router = require("../../../router.js");
var WxParse = require('../../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [        
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      id: options.id
    });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    app.request({
      url: router.user.couponInfo,
      method: "POST",
      data: {
        userId: wx.getStorageSync('userInfo').id,
        id: that.data.id
      },
      success: function (data) {
        console.log(data);
        //return false;
        if (data.status == true) { 
            data.coupon.bg_pic = '../../../image/c2.jpg';          
            that.setData({
              list: data.coupon ,             
            });        
            WxParse.wxParse('article', 'html', data.coupon.info, that, 5);  
        } else {
          wx.showToast({
            title: '获取信息失败',
            icon: 'none',
            mask: true,
            duration: 2000
          });
        }
      }
    })
  }
})